<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class named_sharable_mutex</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../interprocess/indexes_reference.html#doxygen.boost_interprocess_header_reference.named__sharable__mutex_8hpp" title="Header &lt;boost/interprocess/sync/named_sharable_mutex.hpp&gt;">
<link rel="prev" href="classboost_1_1interprocess_1_1named__semaphore.html" title="Class named_semaphore">
<link rel="next" href="classboost_1_1interprocess_1_1named__upgradable__mutex.html" title="Class named_upgradable_mutex">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="classboost_1_1interprocess_1_1named__semaphore.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../interprocess/indexes_reference.html#doxygen.boost_interprocess_header_reference.named__sharable__mutex_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="classboost_1_1interprocess_1_1named__upgradable__mutex.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class named_sharable_mutex</span></h2>
<p>boost::interprocess::named_sharable_mutex</p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../interprocess/indexes_reference.html#doxygen.boost_interprocess_header_reference.named__sharable__mutex_8hpp" title="Header &lt;boost/interprocess/sync/named_sharable_mutex.hpp&gt;">boost/interprocess/sync/named_sharable_mutex.hpp</a>&gt;

</span>
<span class="keyword">class</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html" title="Class named_sharable_mutex">named_sharable_mutex</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>

  <span class="comment">// <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#id96-bb">public member functions</a></span>
  <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1abf93f71d8c77c1817b88d3dffa56c320"><span class="identifier">named_sharable_mutex</span></a><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1create__only__t.html" title="Struct create_only_t">create_only_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span><span class="special">,</span> 
                       <span class="keyword">const</span> <a class="link" href="classboost_1_1interprocess_1_1permissions.html" title="Class permissions">permissions</a> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">permissions</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1ad508d06db75da55ba513dd583ea22d07"><span class="identifier">named_sharable_mutex</span></a><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1open__or__create__t.html" title="Struct open_or_create_t">open_or_create_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span><span class="special">,</span> 
                       <span class="keyword">const</span> <a class="link" href="classboost_1_1interprocess_1_1permissions.html" title="Class permissions">permissions</a> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">permissions</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1afac980d5bbff26eea69df08b1d8a958e"><span class="identifier">named_sharable_mutex</span></a><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1open__only__t.html" title="Struct open_only_t">open_only_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a971c3d97e19035e8f1c5acc6cc554f06"><span class="identifier">named_sharable_mutex</span></a><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1create__only__t.html" title="Struct create_only_t">create_only_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">wchar_t</span> <span class="special">*</span><span class="special">,</span> 
                       <span class="keyword">const</span> <a class="link" href="classboost_1_1interprocess_1_1permissions.html" title="Class permissions">permissions</a> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">permissions</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a4d44c624f7f05db15ba79483d7870e24"><span class="identifier">named_sharable_mutex</span></a><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1open__or__create__t.html" title="Struct open_or_create_t">open_or_create_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">wchar_t</span> <span class="special">*</span><span class="special">,</span> 
                       <span class="keyword">const</span> <a class="link" href="classboost_1_1interprocess_1_1permissions.html" title="Class permissions">permissions</a> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">permissions</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a5dcf4828e82b052516cbb8422fd980d8"><span class="identifier">named_sharable_mutex</span></a><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1open__only__t.html" title="Struct open_only_t">open_only_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">wchar_t</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1ab73673f72d2f947052653f8354e0a119"><span class="special">~</span><span class="identifier">named_sharable_mutex</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1ac79dfa17d13690af715c19e93d93f7eb"><span class="identifier">lock</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a2cea049a3f46081d174ff951b9bc430f"><span class="identifier">try_lock</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a77916b3663f86a2a71165917863e375c"><span class="identifier">timed_lock</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1abcb9d2afaa0bcfca23d52f86f4f7f46f"><span class="identifier">try_lock_until</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Duration<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a954506b5e8dfd446fb247a5f72802c4b"><span class="identifier">try_lock_for</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Duration</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a9e54928f1ca8e82a08eef49ca685b938"><span class="identifier">unlock</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a275d23e26a58004eb16ae912d4f9c41d"><span class="identifier">lock_sharable</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a1194dbc0b41fa703c005fbd8266b0b6b"><span class="identifier">lock_shared</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a185b4020c0d535ba5e0433bc912f7262"><span class="identifier">try_lock_sharable</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1aa254afc7a492288d04c1593e336dc357"><span class="identifier">try_lock_shared</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1adefed13f6989018a7aeae6be6387d948"><span class="identifier">timed_lock_sharable</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a95f16856c2a8c1cf3b366e6f9a6f6022"><span class="identifier">try_lock_shared_until</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Duration<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a8521635e7075c0186dc561521b9d7edc"><span class="identifier">try_lock_shared_for</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Duration</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a2e12cceca592f74759ff5e3b345f402b"><span class="identifier">unlock_sharable</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1af0a2a2018748c472b8e2276d8db2bffd"><span class="identifier">unlock_shared</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#id97-bb">public static functions</a></span>
  <span class="keyword">static</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a037051bc7fe01395629f7aaf38f947a2"><span class="identifier">remove</span></a><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">static</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a6741be5620bff8b21c6c4faf91db1c0c"><span class="identifier">remove</span></a><span class="special">(</span><span class="keyword">const</span> <span class="keyword">wchar_t</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.16.19.3.72.4.4"></a><h2>Description</h2>
<p>A sharable mutex with a global name, so it can be found from different processes. This mutex can't be placed in shared memory, and each process should have it's own named sharable mutex. </p>
<div class="refsect2">
<a name="id-1.3.16.19.3.72.4.4.3"></a><h3>
<a name="id96-bb"></a><code class="computeroutput">named_sharable_mutex</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1abf93f71d8c77c1817b88d3dffa56c320"></a><span class="identifier">named_sharable_mutex</span><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1create__only__t.html" title="Struct create_only_t">create_only_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> name<span class="special">,</span> 
                     <span class="keyword">const</span> <a class="link" href="classboost_1_1interprocess_1_1permissions.html" title="Class permissions">permissions</a> <span class="special">&amp;</span> perm <span class="special">=</span> <span class="identifier">permissions</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>
<p>Creates a global sharable mutex with a name. If the sharable mutex can't be created throws <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a> </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1ad508d06db75da55ba513dd583ea22d07"></a><span class="identifier">named_sharable_mutex</span><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1open__or__create__t.html" title="Struct open_or_create_t">open_or_create_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> name<span class="special">,</span> 
                     <span class="keyword">const</span> <a class="link" href="classboost_1_1interprocess_1_1permissions.html" title="Class permissions">permissions</a> <span class="special">&amp;</span> perm <span class="special">=</span> <span class="identifier">permissions</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>
<p>Opens or creates a global sharable mutex with a name. If the sharable mutex is created, this call is equivalent to named_sharable_mutex(create_only_t, ...) If the sharable mutex is already created, this call is equivalent to named_sharable_mutex(open_only_t, ... ). </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1afac980d5bbff26eea69df08b1d8a958e"></a><span class="identifier">named_sharable_mutex</span><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1open__only__t.html" title="Struct open_only_t">open_only_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> name<span class="special">)</span><span class="special">;</span></pre>
<p>Opens a global sharable mutex with a name if that sharable mutex is previously. created. If it is not previously created this function throws <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a>. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a971c3d97e19035e8f1c5acc6cc554f06"></a><span class="identifier">named_sharable_mutex</span><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1create__only__t.html" title="Struct create_only_t">create_only_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">wchar_t</span> <span class="special">*</span> name<span class="special">,</span> 
                     <span class="keyword">const</span> <a class="link" href="classboost_1_1interprocess_1_1permissions.html" title="Class permissions">permissions</a> <span class="special">&amp;</span> perm <span class="special">=</span> <span class="identifier">permissions</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>
<p>Creates a global sharable mutex with a name. If the sharable mutex can't be created throws <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a></p>
<p>Note: This function is only available on operating systems with native wchar_t APIs (e.g. Windows). </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a4d44c624f7f05db15ba79483d7870e24"></a><span class="identifier">named_sharable_mutex</span><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1open__or__create__t.html" title="Struct open_or_create_t">open_or_create_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">wchar_t</span> <span class="special">*</span> name<span class="special">,</span> 
                     <span class="keyword">const</span> <a class="link" href="classboost_1_1interprocess_1_1permissions.html" title="Class permissions">permissions</a> <span class="special">&amp;</span> perm <span class="special">=</span> <span class="identifier">permissions</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>
<p>Opens or creates a global sharable mutex with a name. If the sharable mutex is created, this call is equivalent to named_sharable_mutex(create_only_t, ...) If the sharable mutex is already created, this call is equivalent to named_sharable_mutex(open_only_t, ... ).</p>
<p>Note: This function is only available on operating systems with native wchar_t APIs (e.g. Windows). </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a5dcf4828e82b052516cbb8422fd980d8"></a><span class="identifier">named_sharable_mutex</span><span class="special">(</span><a class="link" href="structboost_1_1interprocess_1_1open__only__t.html" title="Struct open_only_t">open_only_t</a><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">wchar_t</span> <span class="special">*</span> name<span class="special">)</span><span class="special">;</span></pre>
<p>Opens a global sharable mutex with a name if that sharable mutex is previously. created. If it is not previously created this function throws <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a>.</p>
<p>Note: This function is only available on operating systems with native wchar_t APIs (e.g. Windows). </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1ab73673f72d2f947052653f8354e0a119"></a><span class="special">~</span><span class="identifier">named_sharable_mutex</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Destroys *this and indicates that the calling process is finished using the resource. The destructor function will deallocate any system resources allocated by the system for use by this process for this resource. The resource can still be opened again calling the open constructor overload. To erase the resource from the system use <a class="link" href="classboost_1_1interprocess_1_1named__sharable__mutex.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a037051bc7fe01395629f7aaf38f947a2">remove()</a>. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1ac79dfa17d13690af715c19e93d93f7eb"></a><span class="identifier">lock</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Requires: The calling thread does not own the mutex.</p>
<p>Effects: The calling thread tries to obtain exclusive ownership of the mutex, and if another thread has exclusive or sharable ownership of the mutex, it waits until it can obtain the ownership. Throws: <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a> on error.</p>
<p>Note: A program may deadlock if the thread that has ownership calls this function. If the implementation can detect the deadlock, an exception could be thrown. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a2cea049a3f46081d174ff951b9bc430f"></a><span class="identifier">try_lock</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Requires: The calling thread does not own the mutex.</p>
<p>Effects: The calling thread tries to acquire exclusive ownership of the mutex without waiting. If no other thread has exclusive or sharable ownership of the mutex this succeeds. Returns: If it can acquire exclusive ownership immediately returns true. If it has to wait, returns false. Throws: <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a> on error.</p>
<p>Note: A program may deadlock if the thread that has ownership calls this function. If the implementation can detect the deadlock, an exception could be thrown. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a77916b3663f86a2a71165917863e375c"></a><span class="identifier">timed_lock</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">)</span><span class="special">;</span></pre>
<p>Requires: The calling thread does not own the mutex.</p>
<p>Effects: The calling thread tries to acquire exclusive ownership of the mutex waiting if necessary until no other thread has exclusive, or sharable ownership of the mutex or abs_time is reached. Returns: If acquires exclusive ownership, returns true. Otherwise returns false. Throws: <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a> on error.</p>
<p>Note: A program may deadlock if the thread that has ownership calls this function. If the implementation can detect the deadlock, an exception could be thrown. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1abcb9d2afaa0bcfca23d52f86f4f7f46f"></a><span class="identifier">try_lock_until</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">)</span><span class="special">;</span></pre>
<p>Same as <code class="computeroutput">timed_lock</code>, but this function is modeled after the standard library interface. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Duration<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a954506b5e8dfd446fb247a5f72802c4b"></a><span class="identifier">try_lock_for</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Duration</span> <span class="special">&amp;</span> dur<span class="special">)</span><span class="special">;</span></pre>
<p>Same as <code class="computeroutput">timed_lock</code>, but this function is modeled after the standard library interface. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a9e54928f1ca8e82a08eef49ca685b938"></a><span class="identifier">unlock</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Precondition: The thread must have exclusive ownership of the mutex. Effects: The calling thread releases the exclusive ownership of the mutex. Throws: An exception derived from <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a> on error. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a275d23e26a58004eb16ae912d4f9c41d"></a><span class="identifier">lock_sharable</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Requires: The calling thread does not own the mutex.</p>
<p>Effects: The calling thread tries to obtain sharable ownership of the mutex, and if another thread has exclusive ownership of the mutex, waits until it can obtain the ownership. Throws: <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a> on error.</p>
<p>Note: A program may deadlock if the thread that has ownership calls this function. If the implementation can detect the deadlock, an exception could be thrown </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a1194dbc0b41fa703c005fbd8266b0b6b"></a><span class="identifier">lock_shared</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Same as <code class="computeroutput">lock_sharable</code> but with a std-compatible interface </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a185b4020c0d535ba5e0433bc912f7262"></a><span class="identifier">try_lock_sharable</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Requires: The calling thread does not own the mutex.</p>
<p>Effects: The calling thread tries to acquire sharable ownership of the mutex without waiting. If no other thread has exclusive ownership of the mutex this succeeds. Returns: If it can acquire sharable ownership immediately returns true. If it has to wait, returns false. Throws: <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a> on error.</p>
<p>Note: A program may deadlock if the thread that has ownership calls this function. If the implementation can detect the deadlock, an exception could be thrown </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1aa254afc7a492288d04c1593e336dc357"></a><span class="identifier">try_lock_shared</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Same as <code class="computeroutput">try_lock_sharable</code> but with a std-compatible interface </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> 
  <span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1adefed13f6989018a7aeae6be6387d948"></a><span class="identifier">timed_lock_sharable</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">)</span><span class="special">;</span></pre>
<p>Requires: The calling thread does not own the mutex.</p>
<p>Effects: The calling thread tries to acquire sharable ownership of the mutex waiting if necessary until no other thread has exclusive ownership of the mutex or abs_time is reached. Returns: If acquires sharable ownership, returns true. Otherwise returns false. Throws: <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a> on error.</p>
<p>Note: A program may deadlock if the thread that has ownership calls this function. If the implementation can detect the deadlock, an exception could be thrown </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> 
  <span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a95f16856c2a8c1cf3b366e6f9a6f6022"></a><span class="identifier">try_lock_shared_until</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">)</span><span class="special">;</span></pre>
<p>Same as <code class="computeroutput">timed_lock_sharable</code>, but this function is modeled after the standard library interface. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Duration<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a8521635e7075c0186dc561521b9d7edc"></a><span class="identifier">try_lock_shared_for</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Duration</span> <span class="special">&amp;</span> dur<span class="special">)</span><span class="special">;</span></pre>
<p>Same as <code class="computeroutput">timed_lock_sharable</code>, but this function is modeled after the standard library interface. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a2e12cceca592f74759ff5e3b345f402b"></a><span class="identifier">unlock_sharable</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Precondition: The thread must have sharable ownership of the mutex. Effects: The calling thread releases the sharable ownership of the mutex. Throws: An exception derived from <a class="link" href="classboost_1_1interprocess_1_1interprocess__exception.html" title="Class interprocess_exception">interprocess_exception</a> on error. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1af0a2a2018748c472b8e2276d8db2bffd"></a><span class="identifier">unlock_shared</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Same as <code class="computeroutput">unlock_sharable</code> but with a std-compatible interface </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.16.19.3.72.4.4.4"></a><h3>
<a name="id97-bb"></a><code class="computeroutput">named_sharable_mutex</code> public static functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">static</span> <span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a037051bc7fe01395629f7aaf38f947a2"></a><span class="identifier">remove</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> name<span class="special">)</span><span class="special">;</span></pre>
<p>Erases a named sharable mutex from the system. Returns false on error. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">static</span> <span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1named__sharable__mutex_1a6741be5620bff8b21c6c4faf91db1c0c"></a><span class="identifier">remove</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">wchar_t</span> <span class="special">*</span> name<span class="special">)</span><span class="special">;</span></pre>
<p>Erases a named sharable mutex from the system. Returns false on error. Never throws. </p>
</li>
</ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2005-2024 Ion Gaztanaga<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="classboost_1_1interprocess_1_1named__semaphore.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../interprocess/indexes_reference.html#doxygen.boost_interprocess_header_reference.named__sharable__mutex_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="classboost_1_1interprocess_1_1named__upgradable__mutex.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
